var $ = require('../../common/helper.js');
Page({
	data: {
		province_id: '',
		city_id: '',
		casy_id: '',
		name: '',
		rs: [],
		total_price: 0,
		total: 0,
		gjj_total: 0,
		person_total: 0,
		firm_total: 0
	},
	onLoad: function (options) {
		if (typeof (options.province_id) == 'undefined' || !options.province_id.length ||
			typeof (options.city_id) == 'undefined' || !options.city_id.length) {
			$.overloadError('请先选择参保城市');
			wx.navigateBack();
			return;
		}
		if (typeof (options.casy_id) == 'undefined' || !options.casy_id.length) {
			$.overloadError('请先选择参保方案');
			wx.navigateBack();
			return;
		}
		var _this = this;
		$.post('api.php?app=home&act=casy_detail', {
			province_id: options.province_id,
			city_id: options.city_id,
			casy_id: options.casy_id,
			gjj: options.gjj
		}, function (json) {
			_this.setData({
				province_id: options.province_id,
				city_id: options.city_id,
				casy_id: options.casy_id,
				name: json.data.name,
				rs: json.data.rs,
				total_price: json.data.total_price,
				total: json.data.total,
				gjj_total: json.data.gjj_total,
				person_total: json.data.person_total,
				firm_total: json.data.firm_total
			});
		});
	}
})